home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
pckey.exe
/
PCKEYD.CPP
< prev
Wrap
C/C++ Source or Header
|
1991-08-23
|
2KB
|
105 lines
/*
pckeyd.cpp
8-23-91
pckey demo
Copyright 1991
John W. Small
All rights reserved
Use freely but acknowledge authorship and copyright.
PSW / Power SoftWare
P.O. Box 10072
McLean, Virginia 22102 8072 USA
John Small
Voice: (703) 759-3838
CIS: 73757,2233
*/
#include <stdio.h>
#include <pckey.hpp>
main()
{
int ch;
unsigned lastShift = PCK.shift();
puts("\n\nPress ESC to continue, any other key"
" to view getch(), ascii(), and scan() ...");
while (!PCK.kbhit())
if (PCK.shift() != lastShift) {
lastShift = PCK.shift();
printf("\n PCK.shift(): %04x",
PCK.shift());
}
while ((ch = PCK.getch()) != ESC) {
printf("\n PCK.getch(): %1c%1c "
"PCK.ascii(): %3d "
"PCK.scan(): %3d",
(ch <= 26 && ch)? '^':' ',
(ch <= 26 && ch)? ch+'@':ch,
PCK.ascii(), PCK.scan());
while (!PCK.kbhit())
if (PCK.shift() != lastShift) {
lastShift = PCK.shift();
printf("\n PCK.shift(): "
"%04x",PCK.shift());
}
}
puts("\n\nPress ESC to continue, any other key"
" to view getkey(), ascii(), and scan() ...");
while (!PCK.kbhit())
if (PCK.shift() != lastShift) {
lastShift = PCK.shift();
printf("\n PCK.shift(): %04x",
PCK.shift());
}
while ((ch = PCK.getkey()) != ESC) {
if (ch >= 0)
printf("\n PCK.getkey(): %1c%1c "
"PCK.ascii(): %3d "
"PCK.scan(): %3d",
(ch <= 26 && ch)? '^':' ',
(ch <= 26 && ch)? ch+'@':ch,
PCK.ascii(), PCK.scan());
else
printf("\n PCK.getkey(): %4d "
"PCK.ascii(): %3d "
"PCK.scan(): %3d",ch,
PCK.ascii(), PCK.scan());
while (!PCK.kbhit())
if (PCK.shift() != lastShift) {
lastShift = PCK.shift();
printf("\n PCK.shift(): "
"%04x",PCK.shift());
}
}
if (PCK.enhanced()) {
puts("\n\nNow for the typematic test. "
"Hold down any key to view the ");
puts("standard rates. ESC for high "
"speed.\n");
PCK.setTypeMatic();
ch = PCK.getch();
while (ch != ESC)
putchar(ch = PCK.getch());
puts("\n\nNow for highest speed hold "
"down any key. ESC to quit.\n");
PCK.fastTypeMatic();
ch = PCK.getch();
while (ch != ESC)
putchar(ch = PCK.getch());
}
else
puts("\n\nKey board is not enhanced.");
PCK.fastTypeMaticOnExit();
return 0;
}